package com.trinity.payment;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * PaymentContext
 */
@Data
public class FeeManager {

    private PaymentState state;
    private FeeItem feeItem;
    private List<Bill> bills;

    public FeeManager() {
        this.feeItem = new FeeItem("2024淑妃");
        this.bills = new ArrayList<>();
        this.state = new DraftState();
    }


    /**
     *  添加选购项
     * @param name
     * @param amount
     */
    public void addFeeOption(String name, Long amount) {
        FeeOption feeOption = new FeeOption(name, amount);
        state.addFeeOption(this, feeOption);
    }

    public void generateBillForPerson(Person person, List<FeeOption> selectedOptions) {
        Bill bill = new Bill(person, selectedOptions);
        bills.add(bill);
    }

    public static void main(String[] args) {
        FeeManager feeManager = new FeeManager();
        feeManager.addFeeOption("语文",222L);
        feeManager.setState(new FailedState());
        feeManager.addFeeOption("语文",222L);
        feeManager.setState(new InProgressState());
        feeManager.addFeeOption("语文",222L);
        feeManager.setState(new NotStartedState());
        feeManager.addFeeOption("语文",222L);
        System.out.println(feeManager.getFeeItem());
    }

}
